#pragma once
#include "particlelsystem.h"
#include "BoundRect.h"


class WPENGIN_API CPlayerParticleSystem :
	public CParticleSystem
{
public:
	CPlayerParticleSystem(DWORD dwTotal,DWORD batchSize);
	~CPlayerParticleSystem(void);
	virtual void Update( float timeDelta );
	virtual void ResetParticle( CAttribute * pAttribute );
	virtual void OnRender(bool bisShowRect=true);
	void UP(){
		if(m_itCurrentPlayer!=m_vecParticles.end())
			m_itCurrentPlayer->m_vVelocity+=D3DXVECTOR3(0,-100,0);}
	void Down(){		if(m_itCurrentPlayer!=m_vecParticles.end())
		m_itCurrentPlayer->m_vVelocity+=D3DXVECTOR3(0,100,0);}
	void Left(){		if(m_itCurrentPlayer!=m_vecParticles.end())
		m_itCurrentPlayer->m_vVelocity+=D3DXVECTOR3(-100,0,0);}
	void Right(){		if(m_itCurrentPlayer!=m_vecParticles.end())
		m_itCurrentPlayer->m_vVelocity+=D3DXVECTOR3(100,0,0);}
	void ShowRect(bool yn){m_bIsShowRect=yn;}
	void NextPlayer()
	{

			  m_itCurrentPlayer++;
		if(m_itCurrentPlayer==m_vecParticles.end())
	  m_itCurrentPlayer=m_vecParticles.begin();

	}
	void SetPaticleNumber(int n)
	{ 
		if(n==0)
		   return ;
		if(n<m_dwTotalParticle)  
		{
		
			

		    m_vecParticles.resize(n);
		   this->Reset();
		   this->m_dwVBoffSet=0;
			m_itCurrentPlayer=m_vecParticles.begin();

		}
	}

const D3DXVECTOR3 & GetCurrentPlayerPos(){return m_itCurrentPlayer->m_vPosition;}
	private:
	bool m_bIsShowRect;
	PARTICLELIST_ITERATOR m_itCurrentPlayer;
};

